import request from '@/utils/request'

// 查询评论列表
export function listReply(query) {
  return request({
    url: '/plainReply/list',
    method: 'get',
    params: query
  })
}

// 查询发送人评论详细
export function getReplyFromId(fromId) {
  return request({
    url: '/plainReply/fromId/' + fromId,
    method: 'get'
  })
}
export function getReplyToId(toId) {
  return request({
    url: '/plainReply/toId/' + toId,
    method: 'get'
  })
}
export function getReplyLastId(lastId) {
  return request({
    url: '/plainReply/lastId/' + lastId,
    method: 'get'
  })
}
export function getReplyContentId(contentId) {
  return request({
    url: '/plainReply/contentId/' + contentId,
    method: 'get'
  })
}

// 查询评论详细
export function getReply(replyId) {
  return request({
    url: '/plainReply/' + replyId,
    method: 'get'
  })
}

// 新增评论
export function addReply(data) {
  return request({
    url: '/plainReply',
    method: 'post',
    data: data
  })
}

// 修改评论
export function updateReply(data) {
  return request({
    url: '/plainReply',
    method: 'put',
    data: data
  })
}

/**
 * 修改评论举报状态
 */
export function updateReport(replyId, report) {
  const data = {
    replyId,
    report
  }
  return request({
    url: '/plainReply/updateReport',
    method: 'put',
    data: data
  })
}

/**
 * 浏览量+1
 */
export function updateClick(data) {
  return request({
    url: '/plainReply/updateClick',
    method: 'put',
    data: data
  })
}

/**
 * 修改评论状态
 */
export function updateStatus(data) {
  return request({
    url: '/plainReply/updateStatus',
    method: 'put',
    data: data
  })
}

/**
 * 点赞量+1
 */
export function updateFabulous(data) {
  return request({
    url: '/plainReply/updateFabulous',
    method: 'put',
    data: data
  })
}
export function updateNumber(data) {
  return request({
    url: '/plainReply/updateNumber',
    method: 'put',
    data: data
  })
}



// 删除评论
export function delReply(replyId) {
  return request({
    url: '/plainReply/' + replyId,
    method: 'delete'
  })
}

/**
 * 批量修改评论举报状态为 1 成功
 */
export function delReport1(replyId) {
  return request({
    url: '/plainReply/delReport1/' + replyId,
    method: 'delete'
  })
}

/**
 * 批量修改评论举报状态为 2 不成功
 */
export function delReport2(replyId) {
  return request({
    url: '/plainReply/delReport2/' + replyId,
    method: 'delete'
  })
}
